<?php
$id		= intval(mosGetParam($_REQUEST, 'id', 0)); 
if ($task=='blogsection'){
	$IDMENU = $id;
	$where = " AND parent_id=0 AND section=".$IDMENU;
}
if ($task=='blogcategory'){
	$sql = "SELECT section FROM #__categories WHERE id=".$id;
	$database->setQuery($sql);
	$database->loadObject($row);
	
	$IDMENU = $row->section;
	$where = " AND parent_id=0 AND section=".$IDMENU;
}
$sql = "SELECT id,title,name FROM #__categories WHERE published=1".$where." ORDER BY ordering ASC, id DESC";
$database->setQuery($sql);
$lsMenuTop = $database->loadObjectList();
?>
<div id="w_menu_top">
	<ul>
		<?php 
		for ($i=0; $i<count($lsMenuTop); $i++){
			//checked
			if ($task == 'blogcategory'){
				if ($lsMenuTop[$i]->id == $id) 
					$checkedMenuTopLi = ' class="active"';
				else
					$checkedMenuTopLi = '';
			}	 		
			$link = sefRelToAbs("index.php?option=com_content&task=blogcategory&id=".$lsMenuTop[$i]->id).$lsMenuTop[$i]->name;	
			?>
			<li<?php echo $checkedMenuTopLi;?>><a class="style-css3" href="<?php echo $link;?>"><?php echo $lsMenuTop[$i]->title;?></a></li>
			<?php 
		}
		?>
	</ul>
</div>